<template>
  <h3>vuex</h3>
  <p>count: {{ count }}</p>
  <button @click="fn">count++</button>
</template>

<script setup>
import { computed } from "vue";
import { useStore } from "vuex";
// this.$store.state.count
const store = useStore();

// console.log(store.state.count);
const count = computed(() => store.state.count);

const fn = () => {
  store.commit("add");
};

// Data() {
//   return {
//     count: this.$store.state.count
//   }
// }
</script>
